package com.endpoint.home.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.endpoint.common.utils.ResultBean;
import com.endpoint.home.dto.BookCommendRespDto;
import com.endpoint.home.entity.HomeBook;
import com.endpoint.home.service.HomeBookService;
import com.endpoint.home.to.BookTo;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 首页小说设置表 前端控制器
 * </p>
 *
 * @author Jack_Li
 * @since 2024-07-03
 */

@Slf4j
@Api(tags = "首页推荐")
@RestController
@RequestMapping("/home/homeBook")
public class HomeBookController {

    @Autowired
    private HomeBookService homeBookService;

    @ApiOperation(value = "首页小说推荐列表查询接口")
    @GetMapping("/bookCommendList")
    public ResultBean<List<BookCommendRespDto>> bookCommendList(){
        List<BookCommendRespDto> list =  homeBookService.bookCommendList();
        return  ResultBean.ok(list);
    }

    @ApiOperation(value = "小说更新榜查询接口")
    @GetMapping("/updateRankList")
    public ResultBean<List<BookTo>> updateRankList(){
        List<BookTo> list = homeBookService.updateRankList();
        return ResultBean.ok(list);
    }

}

